from django.db import models

# Create your models here.


#友链
class FriendLink(models.Model):
    title = models.CharField(max_length=100, db_column='网站名', verbose_name='网站名')

    url = models.URLField(db_column='友链地址', verbose_name='地址')

    desc=models.CharField(max_length=100,db_column='描述',verbose_name='描述',default='')

    weight = models.PositiveIntegerField(default=1, db_column='权重', verbose_name='权重', help_text='权重越高越靠前')

    class Meta:
        db_table = '友链'
        verbose_name = verbose_name_plural = db_table
        ordering=['-weight']
    #返回所有的友链信息
    @classmethod
    def get_all_link(cls):
        return cls.objects.all()